//
//  Macro.h
//  
//
//  Created by Q on 2023/2/28.
//

#ifndef Macro_h
#define Macro_h

//#define UMAPPKEY @"6483d131e31d6071ec4e1eb3"
//#define UMSDKInfo @"AX41a+G67f37PSn7C9IYpMwgpfv2NeWy7qcPMh0JyMROIqKB1v5AsgxRTW9hRaY1F6P4a7jrseTjZ6TGHWEbZoHGMh+liJ8Jx7HmO0Nrinn7YlkEWddH3fqj1C6gVVY99XFW7VO/PTAPOkyIqrv9rWQkT3FI+Jc7aYN8TxacJ74FwpT8Etq8CYAbV/3/SL+fvZX2L91o1T5oPv0EA7wmQI8b0mPLFmiWRmfwdXL3tUf5ttSGh+b5Oa+3P11UQS9z9O/beGKx/PY="

/// 屏幕的宽度和高度
#define SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width
#define SCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height
/// 导航栏
#define NavBarHeight [[UINavigationController alloc] init].navigationBar.frame.size.height
/// 状态栏高度
#define STATUSBAR_HEIGHT [QITools getStatusHeight]//[[UIApplication sharedApplication] statusBarFrame].size.height
/// 导航和状态栏高度
#define NAVGATION_HEIGHT STATUSBAR_HEIGHT + 44
/// tabbar高度
#define TABBAR_HEIGHT [[UITabBarController alloc] init].tabBar.frame.size.height + FOOT_HEIGHT
/// 底部TaB的高度
#define FOOT_HEIGHT [QITools getBottomHeight]


#define BottomHeight \
({CGFloat bottom=0.0;\
if (@available(iOS 13.0, *)) {\
    NSSet *set = [UIApplication sharedApplication].connectedScenes;\
    UIWindowScene *windowScene = [set anyObject];\
    UIWindow *window = windowScene.windows.firstObject;\
    return window.safeAreaInsets.bottom;\
} else if (@available(iOS 11.0, *)) {\
    UIWindow *window = [UIApplication sharedApplication].windows.firstObject;\
    return window.safeAreaInsets.bottom;\
} else { \
    bottom=0;\
}\
(bottom);\
})
/**
 *  竖屏底部安全区域
 */
#define kSafeAreaHeight \
({CGFloat bottom=0.0;\
if (@available(iOS 11.0, *)) {\
bottom = [[UIApplication sharedApplication] delegate].window.safeAreaInsets.bottom;\
} else { \
bottom=0;\
}\
(bottom);\
})




//字体大小
#define FONT(x) [UIFont systemFontOfSize:x]
#define BFONT(x) [UIFont boldSystemFontOfSize:x]

//一些缩写
#define kApplication        [UIApplication sharedApplication]
#define kKeyWindow          [UIApplication sharedApplication].keyWindow
#define kAppDelegate        [UIApplication sharedApplication].delegate
#define kUserDefaults       [NSUserDefaults standardUserDefaults]
#define kNotificationCenter [NSNotificationCenter defaultCenter]



/// RGB颜色
#define rgb(r, g, b)     rgba(r, g, b, 1.0)
#define rgba(r, g, b,a)     [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:(a)]
#define RandomColor [UIColor colorWithRed:arc4random_uniform(256)/255.0 green:arc4random_uniform(256)/255.0 blue:arc4random_uniform(256)/255.0 alpha:1.0]
#define RGBA_OF(rgbValue)   [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
#define RGBAOF(rgbValue, alphas)   [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:alphas]


/// 根据hex 获取颜色
#define ColorWithString(__hexString__) ([ZJUIUtil colorWithHexString:__hexString__])

#define UIColorFromRGB(rgbValue)   [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]



//常用颜色
#define color333333 ColorWithString(@"#333333")
#define color666666 ColorWithString(@"#666666")
#define color999999 ColorWithString(@"#999999")



/// 弱引用
//#define WeakSelf                      __weak typeof(self) weakSelf = self;
#define weakself(A) __weak typeof(A) weakself = A;



#define  image(A)   [UIImage imageNamed:A]

/// 字符串
#define stringWithFormat(str) [NSString stringWithFormat:@"%@", str]
#define stringWithFormats(str1, str2) [NSString stringWithFormat:@"%@%@", str1, str2]
#define isEqualToString(str1, str2) [str1 isEqualToString:str2]

#define UserDefaults [NSUserDefaults standardUserDefaults]

// ------------------------- DEBUG 模式下打印日志,当前行 -------------------------
#ifdef DEBUG
#   define NSLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
#   define NSLog(...)
#endif


#endif /* Macro_h */
